package handler

import (
	"360video/video-api/api/reponse"
	"360video/video-api/api/request"
	"360video/video-api/config"
	__ "360video/video-srv/handler/proto"
	"github.com/gin-gonic/gin"
	"log"
)

func VideoDetails(c *gin.Context) {
	req := request.VideoDetails{}
	if c.ShouldBind(&req) != nil {
		reponse.Error(c, "绑定失败")
		return
	}
	r, err := config.VideosClient.VideoDetails(c, &__.VideoDetailsReq{
		Id: int64(req.Id),
	})
	if err != nil {
		log.Fatalf("could not greet: %v", err)
	}
	reponse.Success(c, "查询成功", __.VideoDetailsResp{
		UserId:  r.UserId,
		Titer:   r.Titer,
		Message: r.Message,
		Static:  r.Static,
		Address: r.Address,
		Year:    r.Year,
		Image:   r.Image,
	})
}
